package com.ysd.twocrm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ysd.twocrm.entity.Course;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CourseMapper extends BaseMapper<Course> {

    //多表查询当前用户班级下所拥有的课程信息
    @Select(value = "select c2.* from classcourse as c1 inner join course as c2 on c1.cid=c2.cid where c1.studentclassid in(select stuclassid from student where stuclassid in(select stuclassid from studentclass where stuclassid in(select studentclassid from classcourse))and exit1=#{userId}) order by c2.cid")
    List<Course> findAllCourse(Integer userId);
    //多表查询课程信息根据学期来查
    @Select(value = "select c2.* from classcourse as c1 inner join course as c2 on c1.cid=c2.cid where c1.studentclassid in(select stuclassid from student where stuclassid in(select stuclassid from studentclass where stuclassid in(select studentclassid from classcourse))and exit1=#{userId} and csemester=#{csemester})")
    List<Course> findAllCourseByCsemester(Integer userId,String csemester);




}
